package com.google.code.jgchart;

public class LinearStripe implements UrlQuery {

	private static final String PARAM = "chf=";

	private String fill = "c";

	private String stripe = "ls";

	private int angle;

	private StringBuilder style = new StringBuilder();

	public LinearStripe setFillBackground(boolean yes) {
		if (yes)
			this.fill = "bg";
		return this;
	}

	public LinearStripe setFillChartArea(boolean yes) {
		if (yes)
			this.fill = "c";
		return this;
	}

	public LinearStripe setAngle(int angle) {
		this.angle = angle;
		return this;
	}

	public LinearStripe appendStyle(String color, float width) {
		if (style.length() > 0) {
			style.append(",");
		}
		style.append(color).append(",").append(width);
		return this;
	}

	public String[] getQuery() {
		if (style.length() == 0) {
			return new String[] { "" };
		}
		StringBuilder sb = new StringBuilder();
		String split = ",";
		sb.append(PARAM).append(fill).append(split).append(stripe).append(split)
				.append(angle).append(split).append(style.toString());
		return new String[] { sb.toString() };
	}
}
